// 接收request 中的暴露的axios
// 这个文件用来封装接口函数
import axios from '../utils/request'
/* 文章分类列表函数 */
export const cateListApi = (obj) => {
  return axios({
    url: '/my/cate/list',
    method: 'get'
  })
}
/* 文章分类列表函数 */
export const addCateApi = (obj) => {
  return axios({
    url: '/my/cate/add',
    method: 'post',
    data: obj
  })
}

// 根据id删除分类
export const deleteApi = (id) => {
  return axios({
    url: '/my/cate/del',
    method: 'DELETE',
    params: {
      id: id
    }
  })
}

// 根据id编辑分类
export const delCateByidApi = (obj) => {
  return axios({
    url: '/my/cate/info',
    method: 'PUT',
    data: obj

  })
}

// 文章管理
// 获取数据
export const getListApi = (obj) => {
  return axios({
    url: '/my/article/list',
    method: 'get',
    params: obj
  })
}

// 删除
export const removeApi = (id) => {
  return axios({
    url: '/my/article/info',
    method: 'DELETE',
    params: {
      id: id
    }
  })
}

// 获取文章预览
export const getArtInfoApi = (id) => {
  return axios({
    url: '/my/article/info',
    method: 'get',
    params: {
      id
    }
  })
}
// 发布文章
export const pybArtApi = (obj) => {
  return axios({
    url: '/my/article/add',
    method: 'post',
    data: obj
  })
}
